import { uniFeatch } from "./uni-fetch"

/**
 * 任务列表
 *  @param {String}  status 
 *  @param {String}  page 
 *  @param {String}  pageSize 
 */
export const tasksListAPI = ({ status, page, pageSize }) => {
  return uniFeatch.get("/driver/tasks/list", { status, page, pageSize })
}

/**
 * 任务详情 
 *  @param {string} jobId 
 */
export const tasksDetailAPI = (jobId) => {
  return uniFeatch.get(`/driver/tasks/details/${jobId}`)
}

/**
 * 延迟提货
 *  @param {String} delayReason -延迟原因
 *  @param {String} delayTime -延迟时间
 *  @param {String} id -司机作业单id
 */
export const tasksDelayAPI = ({ delayReason, delayTime, id }) => {
  return uniFeatch.put("/driver/tasks/delay", { delayReason, delayTime, id })
}

/**
 * 提货
 *  @property {Object} data - 接口参数
 */
export const pickupAPI = (data) => {
  return uniFeatch.post('/driver/tasks/takeDelivery', data)
}

/**
 * 上报异常
 *  @param {Object} data - 接口数据
 */
export const exceptAPI = (data) => {
  return uniFeatch.post('/driver/tasks/reportException', data)
}

/**
 * 交付
 *  @param {Object} data - 接口数据
 */
export const deliverAPI = (data) => {
  return uniFeatch.post('/driver/tasks/deliver', data)
}

/**
 * 回车登记
 *  @param {Object} data - 接口数据
 */
export const truckRegistrationAPI = (data) => {
  return uniFeatch.post('/driver/tasks/truckRegistration', data)
}